<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The SplTempFileObject class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="splfileobject.valid.html">« SplFileObject::valid</a></li>
      <li style="float: right;"><a href="spltempfileobject.construct.html">SplTempFileObject::__construct »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="spl.files.html">文件处理</a></li>
    <li>The SplTempFileObject class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.spltempfileobject" class="reference">

 <h1 class="title">The SplTempFileObject class</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 5 &gt;= 5.1.2, PHP 7, PHP 8)</p>


  <div class="section" id="spltempfileobject.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    The SplTempFileObject class offers an object-oriented interface for a temporary file.
   </p>
  </div>


  <div class="section" id="spltempfileobject.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass">
     
    </div>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">SplTempFileObject</strong>
     </span>

     <span class="ooclass">
      <span class="modifier">extends</span>
       <a href="class.splfileobject.html" class="classname">SplFileObject</a>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 继承的常量 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.splfileobject.html#splfileobject.constants.drop-new-line"><var class="varname">SplFileObject::DROP_NEW_LINE</var></a></var>;</div>
<div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.splfileobject.html#splfileobject.constants.read-ahead"><var class="varname">SplFileObject::READ_AHEAD</var></a></var>;</div>
<div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.splfileobject.html#splfileobject.constants.skip-empty"><var class="varname">SplFileObject::SKIP_EMPTY</var></a></var>;</div>
<div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.splfileobject.html#splfileobject.constants.read-csv"><var class="varname">SplFileObject::READ_CSV</var></a></var>;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="spltempfileobject.construct.html" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$maxMemory</code><span class="initializer"> = 2 * 1024 * 1024</span></span>)</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 继承的方法 */</div>
    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.current.html" class="methodname">SplFileObject::current</a></span>(): <span class="type"><span class="type">string</span>|<span class="type">array</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.eof.html" class="methodname">SplFileObject::eof</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.fflush.html" class="methodname">SplFileObject::fflush</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.fgetc.html" class="methodname">SplFileObject::fgetc</a></span>(): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.fgetcsv.html" class="methodname">SplFileObject::fgetcsv</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$separator</code><span class="initializer"> = &quot;,&quot;</span></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$enclosure</code><span class="initializer"> = &quot;\&quot;&quot;</span></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$escape</code><span class="initializer"> = &quot;\\&quot;</span></span>): <span class="type"><span class="type">array</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.fgets.html" class="methodname">SplFileObject::fgets</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.fgetss.html" class="methodname">SplFileObject::fgetss</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$allowable_tags</code><span class="initializer"> = ?</span></span>): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.flock.html" class="methodname">SplFileObject::flock</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$operation</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$wouldBlock</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.fpassthru.html" class="methodname">SplFileObject::fpassthru</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.fputcsv.html" class="methodname">SplFileObject::fputcsv</a></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">array</span> <code class="parameter">$fields</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$separator</code><span class="initializer"> = &quot;,&quot;</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$enclosure</code><span class="initializer"> = &quot;\&quot;&quot;</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$escape</code><span class="initializer"> = &quot;\\&quot;</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$eol</code><span class="initializer"> = &quot;\n&quot;</span></span><br>): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.fread.html" class="methodname">SplFileObject::fread</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code></span>): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.fscanf.html" class="methodname">SplFileObject::fscanf</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$format</code></span>, <span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter reference">&...$vars</code></span>): <span class="type"><span class="type">array</span>|<span class="type">int</span>|<span class="type">null</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.fseek.html" class="methodname">SplFileObject::fseek</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$offset</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$whence</code><span class="initializer"> = <strong><code>SEEK_SET</code></strong></span></span>): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.fstat.html" class="methodname">SplFileObject::fstat</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.ftell.html" class="methodname">SplFileObject::ftell</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.ftruncate.html" class="methodname">SplFileObject::ftruncate</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$size</code></span>): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.fwrite.html" class="methodname">SplFileObject::fwrite</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code><span class="initializer"> = 0</span></span>): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.getchildren.html" class="methodname">SplFileObject::getChildren</a></span>(): <span class="type">null</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.getcsvcontrol.html" class="methodname">SplFileObject::getCsvControl</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.getflags.html" class="methodname">SplFileObject::getFlags</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.getmaxlinelen.html" class="methodname">SplFileObject::getMaxLineLen</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.haschildren.html" class="methodname">SplFileObject::hasChildren</a></span>(): <span class="type"><span class="type false">false</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.key.html" class="methodname">SplFileObject::key</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.next.html" class="methodname">SplFileObject::next</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.rewind.html" class="methodname">SplFileObject::rewind</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.seek.html" class="methodname">SplFileObject::seek</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$line</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.setcsvcontrol.html" class="methodname">SplFileObject::setCsvControl</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$separator</code><span class="initializer"> = &quot;,&quot;</span></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$enclosure</code><span class="initializer"> = &quot;\&quot;&quot;</span></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$escape</code><span class="initializer"> = &quot;\\&quot;</span></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.setflags.html" class="methodname">SplFileObject::setFlags</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.setmaxlinelen.html" class="methodname">SplFileObject::setMaxLineLen</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$maxLength</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileobject.valid.html" class="methodname">SplFileObject::valid</a></span>(): <span class="type">bool</span></div>

    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getatime.html" class="methodname">SplFileInfo::getATime</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getbasename.html" class="methodname">SplFileInfo::getBasename</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$suffix</code><span class="initializer"> = &quot;&quot;</span></span>): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getctime.html" class="methodname">SplFileInfo::getCTime</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getextension.html" class="methodname">SplFileInfo::getExtension</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getfileinfo.html" class="methodname">SplFileInfo::getFileInfo</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$class</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type"><a href="class.splfileinfo.html" class="type SplFileInfo">SplFileInfo</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getfilename.html" class="methodname">SplFileInfo::getFilename</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getgroup.html" class="methodname">SplFileInfo::getGroup</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getinode.html" class="methodname">SplFileInfo::getInode</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getlinktarget.html" class="methodname">SplFileInfo::getLinkTarget</a></span>(): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getmtime.html" class="methodname">SplFileInfo::getMTime</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getowner.html" class="methodname">SplFileInfo::getOwner</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getpath.html" class="methodname">SplFileInfo::getPath</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getpathinfo.html" class="methodname">SplFileInfo::getPathInfo</a></span>(<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$class</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type"><span class="type">?</span><span class="type"><a href="class.splfileinfo.html" class="type SplFileInfo">SplFileInfo</a></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getpathname.html" class="methodname">SplFileInfo::getPathname</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getperms.html" class="methodname">SplFileInfo::getPerms</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getrealpath.html" class="methodname">SplFileInfo::getRealPath</a></span>(): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.getsize.html" class="methodname">SplFileInfo::getSize</a></span>(): <span class="type"><span class="type">int</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.gettype.html" class="methodname">SplFileInfo::getType</a></span>(): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.isdir.html" class="methodname">SplFileInfo::isDir</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.isexecutable.html" class="methodname">SplFileInfo::isExecutable</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.isfile.html" class="methodname">SplFileInfo::isFile</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.islink.html" class="methodname">SplFileInfo::isLink</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.isreadable.html" class="methodname">SplFileInfo::isReadable</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.iswritable.html" class="methodname">SplFileInfo::isWritable</a></span>(): <span class="type">bool</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.openfile.html" class="methodname">SplFileInfo::openFile</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$mode</code><span class="initializer"> = &quot;r&quot;</span></span>, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$useIncludePath</code><span class="initializer"> = <strong><code>false</code></strong></span></span>, <span class="methodparam"><span class="type">?</span><span class="type"><span class="type">resource</span><span class="type"></span></span> <code class="parameter">$context</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type"><a href="class.splfileobject.html" class="type SplFileObject">SplFileObject</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.setfileclass.html" class="methodname">SplFileInfo::setFileClass</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$class</code><span class="initializer"> = SplFileObject::class</span></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.setinfoclass.html" class="methodname">SplFileInfo::setInfoClass</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$class</code><span class="initializer"> = SplFileInfo::class</span></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="splfileinfo.tostring.html" class="methodname">SplFileInfo::__toString</a></span>(): <span class="type">string</span></div>

   }</div>


  </div>

 </div>

 






<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="spltempfileobject.construct.html">SplTempFileObject::__construct</a> — Construct a new temporary file object</li></ul>
</div>
</div></div></body></html>